package com.brspace.qualitycontrol.controller.admin;



import com.brspace.qualitycontrol.entity.Process;
import com.brspace.qualitycontrol.mapper.ProcessMapper;
import com.brspace.qualitycontrol.service.ProcessService;
import com.brspace.qualitycontrol.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * <p>
 *  流程引擎-流程操作
 * </p>
 *
 * @author Hugo
 * @since 2021-03-22
 */
@Api(description = "流程配置")
@RestController
@RequestMapping("/admin/process/process")
public class ProcessController {
    @Resource
    private ProcessMapper processMapper;
    @Resource
    private ProcessService processService;

    /**
     * 流程配置获取
     * @return null
     */
    @ApiOperation("获取流程")
    @PostMapping("getprocess")
    public R getprocess(){
        return R.ok().data("list", processMapper.selectList(null));
    }
    /**
     * @Params process 路由对象
     * @return json数据
     */
    @ApiOperation("添加流程")
    @PostMapping("save")
    public R saveProcess(Process process) {
        processService.saveProcess(process);
        return R.ok();
    }
    /**
     * 添加流程对象
     * @param process
     * @return
     */
    @ApiOperation("添加流程")
    @PostMapping("addPro")
    public R addPro(@ApiParam(value = "流程对象") @RequestBody Process process){
        processService.saveProcess(process);
        return R.ok();
    }

}

